#pragma once
#include ".\ECGXmlNode.h"

enum ERROR_ECGXML
{
	ERROR_ECGXML_SUCCESS = 0,
	ERROR_ECGXML_MSXML_UNINSTALL,
	ERROR_ECGXML_OUTOFMEMORY,
	ERROR_ECGXML_FILE_NOEXIST,
	ERROR_ECGXML_FILENAME_INVALID,
	ERROR_ECGXML_NODE_NOEXIST,
	ERROR_ECGXML_ACCESSDENIED,
	ERROR_ECGXML_OTHER
};

// CECGXmlParser command target

class XML_PARSER;
class CXmlElmentNode;
class AFX_EXT_CLASS CECGXmlParser
{
public:
	CECGXmlParser();
	virtual ~CECGXmlParser();

public:
	BOOL	ReSet();
	LONG	InitializeFile(const CString &szXmlFileName,int nMode);
	LONG	LoadFile(const CString &szXmlFileName);
	LONG	SaveToFile(const CString &szXmlFileName);

	LONG	GetNodeCount(const CString &szNodeXPath, int nType);
	LONG	GetChildNodeCount(const CString &szNodeXPath);
	LONG	ParseNode(CECGXmlNode& oNode,const CString& szXPath);
	LONG	ParseChildNode(CECGXmlNode& oNode,const CString& szXPath, const LONG lChildIndex);

	LONG	SetNodeContent(const CString& szXPath, const CString& szContent);
	LONG	GetNodeContent(const CString& szXPath, CString& szContent);
	LONG	SetNodeAttributeValue(const CString& szXPath,const CString& szAttribName, const CString& szValue);
	LONG	GetNodeAttributeValue(const CString& szXPath,const CString& szAttribName, CString& szValue);

protected:
	XML_PARSER* GetXmlParser();
	BOOL		CopyData(CECGXmlNode* pNode1,CXmlElmentNode* pNode2);
	
private:
 	XML_PARSER* m_pXMLParser;
};


